package com.wangjw.aop;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Created by wangjw on 18/6/19.
 */
public class XmlClient {

    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("spring/spring-aop.xml"); // 获取 Spring Context
        Greeting greeting = (Greeting) context.getBean("greetingImpl"); // 从 Context 中根据 id 获取 Bean 对象
        greeting.say("Jack"); // 调用代理的方法

        Apology apology = (Apology) greeting;
        apology.saySorry("Jack");
    }
}
